<?php

namespace app\admin\controller\yunfood\printer;

use addons\yunfood\library\Backend;
use \addons\yunfood\model\Config as ConfigModel;

/**
 * 配置模块
 */
class Config extends Backend
{
    /**
     * @var ConfigModel
     */
    protected $model;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new ConfigModel();
    }

    /**
     * 基础设置
     */
    public function index()
    {
        if ($this->request->isPost()) {
            if ($params = $this->request->post('row/a')) {
                ConfigModel::saveAllAttributes($params);
                $this->success();
            }
            $this->error(__('Parameter %s can not be empty', ''));
        }
        $row = ConfigModel::getAllAttributes();

        return $this->view->fetch(null, ['row' => $row]);
    }

    public function add()
    {
        return;
    }

    public function edit($ids = null)
    {
        return;
    }

    public function del($ids = null)
    {
        return;
    }

    public function multi($ids = null)
    {
        return;
    }
}
